import { CanDeactivate } from "@angular/router";
import { ProductComponent } from "../product/product.component"
export class UnsaveGuard implements CanDeactivate<ProductComponent> {
    canDeactivate(component: ProductComponent) {//当离开改页面(组件)时会自动调用该方法
        return window.confirm("你还没有保存，确定要离开么？")
    }
}